<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Primitive方式创建对象</title>
    <script src="js/traceur.js"></script>
    <script src="js/bootstrap.js"></script>
    <script type="module">
        //String构造函数用于创建一个对应的字符串对象
        var s1 = "String";
        var s2 = new String("String");
        console.log(typeof s1); //string
        console.log(typeof s2); // object
        console.log(s1 == s2); // true
        console.log(s1.length); // 6
        //可以修改成如下的样子
        var s1 = "String";
        var s2 = new String("String");
        console.log(typeof s1);  // string
        console.log(typeof s2);  // object
        console.log(s1 == s2.valueOf()); // true
        console.log((new String(s1)).length); // 6
    </script>

</head>
<body>

</body>
</html>